<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>方法</title>
</head>
<body>
<p>

    <!--    Math.方法()   -->
    abs(x)     <b>返回数的绝对值。 </b><br/>
    ceil(x)    <b>对数进行上舍入。</b><br/>
    cos(x)     <b>返回数的余弦。</b><br/>
    exp(x)     <b>返回 e 的指数。</b><br/>
    floor(x)   <b>对数进行下舍入。</b><br/>
    log(x)     <b>返回数的自然对数（底为e）。</b><br/>
    max(x,y)   <b>返回 x 和 y 中的最高值。</b><br/>
    min(x,y)   <b>返回 x 和 y 中的最低值。</b><br/>
    pow(x,y)   <b>返回 x 的 y 次幂。</b><br/>
    random()   <b>返回 0 ~ 1 之间的随机数。</b><br/>
    round(x)   <b>把数四舍五入为最接近的整数。</b><br/>
    sin(x)     <b>返回数的正弦。</b><br/>
    sqrt(x)    <b>返回数的平方根。</b><br/>
    tan(x)     <b>返回角的正切。</b><br/>
</p>

<script type="text/javascript">
    function random(m,n){
        return Math.floor(Math.random()*(m-n)+m);
    }
    /*时间*/
    var now = new Date();
    console.log(Date());
    console.log(now.getTime());
    console.log(now.valueOf());
    console.log(now.getDate());
    console.log(now.getDay());
    console.log(random(200,300));
    function Time(){
        var now = new Date();
        var year = now.getFullYear();
        var month = now.getMonth();
        var date = now.getDate();
        var hours = now.getHours();
        var minutes = now.getMinutes()
        var seconds = now.getSeconds();
        month =  month < 10 ? '0'+month : month;
        date =  date < 10 ? '0'+date : date;
        hours =  hours < 10 ? '0'+hours : hours;
        minutes =  minutes < 10 ? '0'+minutes : minutes;
        seconds =  seconds < 10 ? '0'+seconds : seconds;
        return ' ' + year + '-' + month + '-' + date + ' ' + hours + ':' + minutes + ':' + seconds;
    }
    console.log(Time());
    /*数组方法*/
    //push pop slice join toString
    var arr = [2,4,6,7,5,3];
    console.log(arr);
    console.log(arr.push(8,9));
    console.log(arr);
    console.log(arr.pop());
    console.log(arr);
    console.log(arr.slice(1,3));//左闭右开
    console.log(arr.slice(2));
    console.log(arr.join('-'));
    console.log(arr);
    console.log(arr.toString());
    /*字符串*/
    var s= "JavaScript";
    var i = s.length;
    console.log(i);
    i = s.indexOf('c');
    console.log(i);
    var c = s.substring(2,5);//左闭右开
    console.log(c);
    var a = s.toUpperCase();
    var b = s.toLowerCase();
    console.log(a,b);
</script>
</body>
</html>